package com.code.constant;

import java.util.HashMap;
import java.util.Map;

/**
 * @ProjectName:code-generator
 * @Author:赵伟杰
 * @Date:2021年06月27日 22:30
 */
public class TypeConstant {
    /***
     * 类型转化的Map
     */
    private static Map<String, String> typeMap = new HashMap<String, String>();

    static {
        typeMap.put("BIGINT", "Integer");
        typeMap.put("INT", "int");
        typeMap.put("VARCHAR", "String");
        typeMap.put("TIMESTAMP","Date");
        typeMap.put("TEXT", "String");
        typeMap.put("DATETIME", "Date");
        typeMap.put("DATE","Date");
        typeMap.put("DECIMAL", "BigDecimal");
        typeMap.put("SMALLINT UNSIGNED","int");
        typeMap.put("TINYINT","int");
        typeMap.put("BIT","int");
        typeMap.put("LONGBLOB","byte[]");
    }
    //    static {
//        typeMap.put("BIGINT", "Long");
//        typeMap.put("INT", "Integer");
//        typeMap.put("VARCHAR", "String");
//        typeMap.put("TEXT", "String");
//        typeMap.put("DATETIME", "Date");
//        typeMap.put("DECIMAL", "Double");
//    }
    public static void addType(String columnType, String javaType) {
        typeMap.put(columnType, javaType);
    }

    public static String getJavaType(String columnType) {
        return typeMap.get(columnType);
    }
}

